package com.lure.base.statemachine.impl;

import com.lure.base.statemachine.State;

import java.util.Map;

/**
 * @author yanwei li create  2024-05-28 23:24
 */
public class StateHelper {

    public static<S,E,C> State<S,E,C> getState(Map<S,State<S,E,C>> stateMap, S stateId){
        State<S, E, C> state = stateMap.get(stateId);
        if (state == null) {
            state = new StateImpl<>(stateId);
            stateMap.put(stateId,state);
        }
        return state;
    }
}
